<template>
  <div>
    <el-dialog title="企业审核" :visible.sync="formVisible1" @close="hide" width='654px'>
      <div slot="title" class="dialog-title">企业审核</div>
      <el-card class="el-card-border">
        <el-row class="info">
          <el-col :span="6">账号：</el-col>
          <el-col :span="18" v-if="company_info.user_info">{{company_info.user_info.mobile}}</el-col>
        </el-row>
        <el-row class="info">
          <el-col :span="6">企业名称：</el-col>
          <el-col :span="18">{{company_info.name}}</el-col>
        </el-row>
        <el-row class="info">
          <el-col :span="6">统一社会信用代码：</el-col>
          <el-col :span="18">{{company_info.credit_code}}</el-col>
        </el-row>
        <el-row class="info">
          <el-col :span="6">营业执照照片：</el-col>
          <el-col :span="18">
            <img :src="baseUrl+'/'+company_info.business_license" alt="" class="img">
          </el-col>
        </el-row>
        <el-form ref="examineForm" :model="formFieldsData1">
          <el-row class="info">
            <el-col :span="6">审核状态：</el-col>
            <el-col :span="18">
              <el-select v-model="formFieldsData1.status" placeholder="请选择" style="width: 92%">
                <el-option
                  v-for="(item,key) in statusList"
                  :key="key"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </el-col>
          </el-row>
          <el-row class="info" v-if="formFieldsData1.status==2">
            <el-col :span="6">驳回原因：</el-col>
            <el-col :span="18">
              <el-input type="textarea" v-model="formFieldsData1.remake" style="width: 92%"></el-input>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
      <div slot="footer" class="dialog-footer">
        <el-button @click="hide" size='medium'>取 消</el-button>
        <el-button type="primary" @click="handleExamineSubmit" size='medium'>确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import formOperate from '@/layout/mixin/formOperate'
export default {
  name: 'Index',
  mixins: [formOperate],
  data() {
    return {
      baseUrl:process.env.VUE_APP_BASE_API,
      formVisible1:false, // 审核dialog隐藏还是显示
      formFieldsData1:{
        id:'',
        status:'',
        remake:''
      },// 审核表单input
      statusList:[
        {id:'',name:'待审核'},
        {id:'1',name:'审核通过'},
        {id:'2',name:'审核驳回'}
      ], // 审核状态
      company_info:'' // 企业信息
    }
  },
  methods: {
    getList() {},
    // 打开审核dialog
    show(item) {
      this.formVisible1  = true
      this.company_info = item
      this.formFieldsData1.id = item.id
    },
    // 取消审核
    hide() {
      this.formVisible1 = false
      for (let key in this.formFieldsData1) {
        this.formFieldsData1[key] = ''
      }
    },
    // 审核提交
    handleExamineSubmit() {
      this.$emit('companyUpdate',this.formFieldsData1,'status')
    }
  }
}
</script>

<style lang="scss" scoped>
  .info{
    line-height: 30px;
    margin-bottom:10px;
  }
  .img{
    width: 150px;
  }
</style>